package com.chinemit.cui.components.navigation.tab
{
	
	import com.chinemit.cui.components.core.CUIComponent;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	
	public class TabBarItem extends CUIComponent
	{
		public static const STATE_SELECT:String = "select"; 
		public static const STATE_UNSELECT:String = "unselect";
		protected var _index:int;
		protected var icon:Bitmap;
		protected var text:String;
		
		private var _currentState:String;

		public function get currentState():String
		{
			return _currentState;
		}

		public function set currentState(value:String):void
		{
			_currentState = value;
		}

		public function TabBarItem(_text:String= null,_icon:Bitmap = null)
		{
			super();
			this.buttonMode = true;
			this.mouseChildren = false;
			reset();
			
			text = _text;
			icon = _icon;
		}
		
		public function get index():int
		{
			return _index;
		}

		public function set index(value:int):void{
			_index = value;
			this.toolTipText = value.toString();
		}

		/**
		 * 从新设置 
		 * 
		 */		
		public function reset():void{
			this.graphics.clear();
			this.graphics.beginFill(0xffffff,0.5);
			this.graphics.drawCircle(0,0,5);
			this.graphics.endFill();
			currentState = STATE_UNSELECT;
		}
		
		/**
		 * 设置成焦点 
		 * 
		 */		
		public function setFocus():void{
			this.graphics.clear();
			this.graphics.beginFill(0xffffff,1);
			this.graphics.drawCircle(0,0,5);
			this.graphics.endFill();	
			currentState = STATE_SELECT;
		}
	}
}